<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>插入表格</title>
<style type="text/css">
<!--
*{padding: 0px; margin: 0px;}
html, body {font-size: 12px; text-align: left; line-height: 18px; padding: 0px; margin:0px; background: #edeae7; overflow: hidden;}
ol,ul,li{list-style:none; margin: 0px; padding: 0px; }
h1,h2,h3,h4,h5,font{ font-size: 12px;}

a:link    {font-size: 12px; color: #000000; text-decoration: none; border:none;}
a:visited {font-size: 12px; color: #000000; text-decoration: none; border:none;}
a:hover   {font-size: 12px; color: #ec7e2d; text-decoration: underline; border:none;}
a:active  {font-size: 12px; color: #000000; text-decoration: none; border:none;}

a img{ border: none;}
.mclear{clear: both; visibility: hidden; font-size: 0px; line-height: 0px; padding: 0px; margin: 0px;}

#Panel{text-align: left; padding-left: 15px; padding-top: 6px;}
	#Panel li{ padding-top: 7px;}
	#Panel select{ font-size: 12px;}
	#Panel .inputs{ font-size: 12px; width: 75px;}
	#Panel .xBtn{ border: 1px solid #333;}
-->
</style>
<script type="text/javascript" src="dialog.js"></script>
<script type="text/javascript">
var sAction = URLParams["action"];

function MoreThanOne(obj, sErr){
	var b=false;
	if (obj.value!=""){
		obj.value=parseFloat(obj.value);
		if (obj.value!="0"){
			b=true;
		}
	}
	if (b==false){
		BaseAlert(obj,sErr);
		return false;
	}
	return true;
}

function SubThis(){
	if(typeof(oCtrlWin)!="undefined"){
		
		if (!MoreThanOne($("d_row"),"无效的行数，至少要1行！")) return;
		if (!MoreThanOne($("d_col"),"无效的列数，至少要1列！")) return;
		
		if ($("d_border").value == "") $("d_border").value = "1";
		if ($("d_cellpadding").value == "") $("d_cellpadding").value = "0";
		if ($("d_cellspacing").value == "") $("d_cellspacing").value = "0";
		
		$("d_border").value = parseFloat($("d_border").value);
		$("d_cellpadding").value = parseFloat($("d_cellpadding").value);
		$("d_cellspacing").value = parseFloat($("d_cellspacing").value);
	
		sRow = $("d_row").value;
		sCol = $("d_col").value;
		sAlign = $("d_align").options[$("d_align").selectedIndex].value;
		sBorder = $("d_border").value;
		sAlignText = $("d_aligntext").options[$("d_aligntext").selectedIndex].value;
		sBorderCollapse = $("d_bordercollapse").options[$("d_bordercollapse").selectedIndex].value;
		sCellPadding = $("d_cellpadding").value;
		sCellSpacing = $("d_cellspacing").value;
		
		sBorderColor="#D2691E";
		var sTable = "<table align='"+sAlign+"' border='"+sBorder+"' cellpadding='"+sCellPadding+"' cellspacing='"+sCellSpacing+"' width='160' bordercolor='"+sBorderColor+"' style='text-align:"+sAlignText+"; border-collapse:"+sBorderCollapse+";'>";
		for (var i=1;i<=sRow;i++){
			sTable = sTable + "<tr>";
			for (var j=1;j<=sCol;j++){
				sTable = sTable + "<td>&nbsp;</td>";
			}
			sTable = sTable + "</tr>";
		}
		sTable = sTable + "</table>";
		var oRange = oMyEditor.seleRestore();
		try{
			if(isIE){	
				oRange.pasteHTML(sTable);
			}else{
				try{
					oCtrlWin.document.execCommand("insertHTML",false,sTable);
				}catch(e){
					var oFragment = oRange.createContextualFragment(sTable) ;
					var oLastNode = oFragment.lastChild;
					oRange.deleteContents();
					oRange.insertNode(oFragment);
				}
			}
		}catch(e){
		
		}
	}
	xClose();
}
</script>
</head>
<body>
<div id="Panel">
    <ul>
        <li>
            表格行数:
            <input type="text" class="inputs" id="d_row" size="10" value="2" onkeypress="event.returnValue=IsDigit();" maxlength="3">
            表格列数:
            <input type="text" class="inputs" id="d_col" size="10" value="1" onkeypress="event.returnValue=IsDigit();" maxlength="3">
        </li>
        <li>
            对齐方式:
            <select id="d_align" style="width:80px">
                <option value="">默认</option>
                <option value="left">左对齐</option>
                <option value="center">居中对齐</option>
                <option value="right">右对齐</option>
            </select>
            文字对齐:
            <select id="d_aligntext" style="width:80px">
				<option value="">默认</option>
				<option value="left">左对齐</option>
				<option value="center">居中对齐</option>
				<option value="right">右对齐</option>
				<option value="justify">两端对齐</option>
			</select>
        </li>
        <li>
            单元间距:
            <input type="text" class="inputs" id="d_cellspacing" size="10" value="0" onkeypress="event.returnValue=IsDigit();" maxlength="3">
            单元边距:
            <input type="text" class="inputs" id="d_cellpadding" size="10" value="0" onkeypress="event.returnValue=IsDigit();" maxlength="3">
        </li>
        <li>
            边框效果:
            <select id="d_bordercollapse" style="width:80px">
				<option value="">默认</option>
				<option value="separate">分开</option>
				<option value="collapse" selected="selected">合并</option>
			</select>
            边框粗细:
            <input type="text" class="inputs" id="d_border" size="10" value="1" onkeypress="event.returnValue=IsDigit();" maxlength="2">
        </li>
        <li>
            <input class="xBtn" type="button" name="SubBtn" id="SubBtn" onclick="SubThis();" value="确定" />
            <input class="xBtn" type="button" name="NoBtn" id="NoBtn" onclick="xClose();" value="取消" />
      	</li>
    </ul>
</div>
</body>
</html>
